<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>站内信管理 [<strong>全部</strong> ]</h2>
	</div>

	<div class="cf">
		<a class="btn" href="{:U('add')}">新 增</a>
		  <button class="btn ajax-post confirm" url="{:U('del')}" target-form="ids">删 除</button>
       分组解释：  1-表示个人，2-表示所有人<!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="手机">
                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>
            </div>
        </div>
	</div>

	<div class="data-table table-striped">
		 <table>
			<thead>
				<tr>
					<th class="row-selected">
					 <input class="checkbox check-all" type="checkbox">
					</th>
					<th>ID</th>			
                    <th>发送标题</th>
					<th>发送用户名</th>
					<th>浏览量</th>
					<th>分组</th>
                     <th>状态</th>
                       <th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="envelope">
					<tr>
					<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$envelope.id|default="无"}"></td>
						<td>{$envelope.id|default="无"}</td>
						<td><a title="编辑" href="{:U('edit?id='.$envelope['id'])}">{$envelope.title|default="无"}</a></td>
						 
						 <td>{$envelope.username}</td>
						  <td>{$envelope.view}</td>
						 <td>{$envelope.group|default="无"}</td>	 
					   <td>{$envelope.status|default="无"}</td>
                         <td>{$envelope.create_time|date='Y-m-d H:i:s',###}</td>
					<td>
                            <a title="编辑" href="{:U('edit?id='.$envelope['id'])}">编辑</a>
                            <a class="confirm ajax-get" title="删除" href="{:U('del?id='.$envelope['id'])}">删除</a>
                        </td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
       
        <!-- 分页 -->
        <div class="page">
{$_page}
        </div>
	</div>
</block>

<block name="script">
 <script type="text/javascript">
        $(function() {
            //搜索功能
            $("#search").click(function() {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮
            highlight_subnav('{:U('index')}');
            //点击排序
        	$('.list_sort').click(function(){
        		var url = $(this).attr('url');
        		var ids = $('.ids:checked');
        		var param = '';
        		if(ids.length > 0){
        			var str = new Array();
        			ids.each(function(){
        				str.push($(this).val());
        			});
        			param = str.join(',');
        		}

        		if(url != undefined && url != ''){
        			window.location.href = url + '/ids/' + param;
        		}
        	});
        });
    </script>
</block>